<template>
	<view>
		<view class="uni-card" v-for="(item, index) in records">
			<view class="uni-card-content">
				<view class="uni-card-content-inner">
					{{item.content}}
				</view>
			</view>
			<view class="uni-card-footer">
				<view class="uni-flex uni-row">
					<view class="text" style="flex: 1;">{{item.createdStamp}}</view>
					<view class="text" style="flex: 1;" v-if="typeId == 1">查看详情</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getActions} from '@/api/mcenter/index'
	export default {
		data() {
			return {
				typeId: 0,
				page: 1,
				pageSize: 10,
				actionsTypes: [
					"NOTIFY",
					"COMMENT_UPVORT",
					"NEW_PUBLISH",
					"AT_ME",
					"NEW_FANS",
					"LOGISTICS",
				],
				records:[]
			};
		},
		onPullDownRefresh() {
			this.page = this.page + 1
			this.loadNotify();
		}
		onLoad(e) {
			this.typeId = typeId;
			this.loadNotify();
		},
		methods: {
			loadNotify() {
				getActions(getParams()).then(response => {
					if(response.status = 200 ) {
						if(response.data.length > 0) {
							this.records.unshift(response.data);
						}
					}
				})
			}
			getParams() {
				let param = {
					page: this.page,
					limit: this.pageSize,
					orderBy: "createdStamp",
					actionType: this.actionsTypes[this.typeId],
					sort: "DESC"
				}
				return param;
			}
		}
		
	}
</script>

<style>

</style>
